package com.academic.web.controller.newuser;


import com.academic.common.core.controller.BaseController;
import com.academic.common.core.page.TableDataInfo;
import com.academic.system.domain.req.NewReq;
import com.academic.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 学生页相关控制器
 * @author
 */
@RestController
@RequestMapping("/newuser")
public class NewUserController extends BaseController {

    private final SysBookService sysBookService;
    private final SchoolReadService schoolReadService;
    private final SysAttendanceService sysAttendanceService;
    private final SysCourseService sysCourseService;
    private final SysExamService    sysExamService;
    private final UserGradeService userGradeService;

    @Autowired
    public NewUserController(SysBookService sysBookService, SchoolReadService schoolReadService, SysAttendanceService sysAttendanceService, SysCourseService sysCourseService, SysExamService sysExamService, UserGradeService userGradeService) {
        this.sysBookService = sysBookService;
        this.schoolReadService = schoolReadService;
        this.sysAttendanceService = sysAttendanceService;
        this.sysCourseService = sysCourseService;
        this.sysExamService = sysExamService;
        this.userGradeService = userGradeService;
    }

    /**
     * 获取用户的读书记录
     * @param newReq
     * @return
     */
    @PostMapping("/getReadBooks")
    public TableDataInfo getReadBooks(@RequestBody NewReq newReq){
        return (sysBookService.getBookHistory(newReq));
    }

    /**
     * 获取用户学籍信息
     * @param
     * @return
     */
    @PostMapping("/getUserSchool")
    public TableDataInfo getUserSchool(@RequestBody NewReq newReq){
        return (schoolReadService.getSchoolRead(newReq));
    }

    /**
     * 获取用户考勤信息
     * @param
     * @return
     */
    @PostMapping("/getAttendance")
    public TableDataInfo getAttendance(@RequestBody NewReq newReq){
        return (sysAttendanceService.getAttendance(newReq));
    }

    /**
     * 获取用户课程信息
     * @param
     * @return
     */
    @PostMapping("/getUserCourse")
    public TableDataInfo getUserCourse(@RequestBody NewReq newReq){
        return (sysCourseService.getCourseHistory(newReq));
    }

    /**
     * 获取用户考试信息
     * @param
     * @return
     */
    @PostMapping("/getUserExam")
    public TableDataInfo getUserExam(@RequestBody NewReq newReq){
        return (sysExamService.getExamHistory(newReq));
    }

    /**
     * 获取用户成绩信息
     * @param
     * @return
     */
    @PostMapping("/getUserGrade")
    public TableDataInfo getUserGrade(@RequestBody NewReq newReq){
        return (userGradeService.getGradeHistory(newReq));
    }
}
